package wechat.app

import org.junit.Ignore
import org.junit.Test
import wechat.base.snd.WCMenu
import wechat.base.snd.WCSubButton

class CreateMenuTest{
	
	@Test
	@Ignore
	def void deletemenu(){
		WXServiceAppFactoryDemo::serviceApp=>[
			deleteMenu
		]		
	}
	@Test
	@Ignore
	def void testCreateMenu(){
		val SERVICE_APP_TASK_HISTORY_URL = "http://operation.linemore.com/taskhistory"; //lanmon
		val SERVICE_APP_TASK_STAT_URL = "http://operation.linemore.com/taskstat"; //lanmon		
		val app = WXServiceAppFactoryDemo::serviceApp		
		 val m =  new WCMenu=>[
		 	withButton(createBtn=>[
		 		name = '客户服务'
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='报修历史'
					url = app.buildAuthConnection(SERVICE_APP_TASK_HISTORY_URL,'111')
				])
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='月度报修统计'
					url = app.buildAuthConnection(SERVICE_APP_TASK_STAT_URL,'1')
				])
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='月度故障统计'
					url = app.buildAuthConnection(SERVICE_APP_TASK_STAT_URL,'2')
				])														 		
		 	])
			withButton(createBtn=>[
				name = '蓝盟优势'		
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='10+司龄员工多'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461790&idx=1&sn=caa4537cfb280ad66d6b36b35b2016ea&scene=18#rd'
				])
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='99.98%到场'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461794&idx=1&sn=fadd72b39baef928c9e0df62b9641c3d&scene=18#rd'
				])
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='16+保安全'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461840&idx=1&sn=260d6be5acf92bcb558d171993dc0f6b&scene=18#rd'
				])
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='1000+客户'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461843&idx=1&sn=a8c038737c5f45427a21fb56e8e89d74&scene=18#rd'
				])									
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='300+专职员工'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461846&idx=1&sn=f16ab55ea1d7859bfac7f8f29975fed1&scene=18#rd'
				])																						
			])
			withButton(createBtn=>[
				name = '推荐服务'		
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='应急服务'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461953&idx=1&sn=e94f048b0212ed99a0240e763a734a05&scene=18#rd'
				])
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='派驻服务'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461964&idx=1&sn=fc6478fb12815e97435a41c0d569bb65&scene=18#rd'
				])				
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='远程服务'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461975&idx=1&sn=1d2902be75ca92ff062b753113da2c32&scene=18#rd'
				])	
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='IT采购'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200461986&idx=1&sn=eb1e04e5e1baa73c0cc1a250d1f9eca5&scene=18#rd'
				])	
				withSubButton(new WCSubButton=>[
					type = 'view'
					name ='组网服务'
					url = 'http://mp.weixin.qq.com/s?__biz=MzA4NDk4MDIxNQ==&mid=200463160&idx=1&sn=fc0a1b7936f2014fbc4c14e1699f68b1&scene=18#rd"'
				])																	
			])
		]
		println(m.build.toString)
		app.createMenu(m)
	}
	
	@Test
	@Ignore	
	def void testGetMenuInfo(){
		WXServiceAppFactoryDemo::serviceApp=>[
			println(getMenuInfo())
		]
	}
}
